//---------------------------------------------------------------------------

#ifndef uFncGDIH
#define uFncGDIH
//---------------------------------------------------------------------------
#include <EIC.h>
//#include "uDessin.h"
int  __fastcall MyGetDeviceCaps( TCanvas *Canvas, int nIndex);

void __fastcall DrawTransparentBitmap(HDC hdc, Graphics::TBitmap *Bmp, short xStart,
                                      short yStart, COLORREF cTransparentColor, double ResolSortieX = 0, double ResolSortieY = 0);

void __fastcall MyDraw(TCanvas *canvas, int X, int Y, TGraphic* Graphic);
void __fastcall MyStretchDraw(TCanvas *canvas, const Windows::TRect &Rect, TGraphic* Graphic);

void __fastcall MyStretchDIBits(
    TCanvas *Canvas,	// handle of device context
    int XDest,	// x-coordinate of upper-left corner of dest. rect.
    int YDest,	// y-coordinate of upper-left corner of dest. rect.
    int nDestWidth,	// width of destination rectangle
    int nDestHeight,	// height of destination rectangle
    int XSrc,	// x-coordinate of upper-left corner of source rect.
    int YSrc,	// y-coordinate of upper-left corner of source rect.
    int nSrcWidth,	// width of source rectangle
    int nSrcHeight,	// height of source rectangle
    CONST VOID *lpBits,	// address of bitmap bits
    CONST BITMAPINFO *lpBitsInfo,	// address of bitmap data
    UINT iUsage,	// usage
    DWORD dwRop 	// raster operation code
   );

   void __fastcall MyPolygon(
    TCanvas *Canvas,	// handle to device context
    const POINT *lpPoints,	// pointer to polygon's vertices
    int nCount 	// count of polygon's vertices
   );


#define ChkSDK_2( Tag, cond, CondEtValError)    if( cond CondEtValError) TraiteLastError( Tag, AnsiString(#cond))
#define ChkSDK( Tag, cond, ValError)    ChkSDK_2( Tag, cond, == ValError)

HDC     __fastcall _CreateDC( EICTag Tag, LPCTSTR lpszDriver, LPCTSTR lpszDevice, LPCTSTR lpszOutput, CONST DEVMODE *lpInitData);
HDC     __fastcall _CreateCompatibleDC( EICTag Tag, HDC hdc);
void    __fastcall _DeleteDC( EICTag Tag, HDC hdc);

int     __fastcall _GetDeviceCaps( EICTag Tag, HDC hdc, int nIndex);
void    __fastcall _ExtTextOut( EICTag Tag, HDC hdc, int X, int Y,	UINT fuOptions,	CONST RECT *lprc, LPCTSTR lpString, UINT cbCount, CONST INT *lpDx);
void    __fastcall _TextOut( EICTag Tag, HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cbString);
void    __fastcall _FillRgn( EICTag Tag, HDC hdc, HRGN hrgn, HBRUSH hbr);
void    __fastcall _BitBlt( EICTag Tag, HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
                                        HDC hdcSrc,  int nXSrc,  int nYSrc,                          DWORD dwRop);
void    __fastcall _StretchBlt( EICTag Tag, HDC hdcDest, int XDest, int YDest, int nDestWidth, int nDestHeight,
                                            HDC hdcSrc,  int XSrc,  int YSrc,  int nSrcWidth,  int nSrcHeight,  DWORD dwRop);
void    __fastcall _StretchDIBits( EICTag Tag, HDC hdc,  int XDest, int YDest, int nDestWidth, int nDestHeight,
                                                         int XSrc,  int YSrc,  int nSrcWidth,  int nSrcHeight,
                                               CONST VOID *lpBits, CONST BITMAPINFO *lpBitsInfo, UINT iUsage, DWORD dwRop);
void    __fastcall _PaintRgn( EICTag Tag, HDC hdc, HRGN hrgn);
void    __fastcall _FillRect( EICTag Tag, HDC hdc, CONST RECT *lprc,	HBRUSH hbr);
void    __fastcall _Rectangle(EICTag Tag, HDC hdc, int nLeftRect, int nTopRect,	int nRightRect,	int nBottomRect);
void    __fastcall _RoundRect(EICTag Tag, HDC hdc, int nLeftRect, int nTopRect,	int nRightRect,	int nBottomRect, int nWidth, int nHeight);
void    __fastcall _Ellipse(EICTag Tag, HDC hdc, int nLeftRect, int nTopRect,	int nRightRect,	int nBottomRect);
void    __fastcall _Polygon(EICTag Tag, HDC hdc, CONST POINT *lpPoints, int nCount);
void    __fastcall _MoveToEx( EICTag Tag, HDC hdc, int X, int Y, LPPOINT lpPoint);
void    __fastcall _LineTo(EICTag Tag, HDC hdc,	int nXEnd, int nYEnd);
int     __fastcall _SetStretchBltMode( EICTag Tag, HDC hdc, int iStretchMode);

void    __fastcall _GetTextMetrics( EICTag Tag, HDC hdc, LPTEXTMETRIC lptm);
UINT    __fastcall _GetTextAlign( EICTag Tag, HDC hdc);
UINT    __fastcall _SetTextAlign( EICTag Tag, HDC hdc,	UINT fMode);
//int     __fastcall _GetTextCharacterExtra( EICTag Tag, HDC hdc);
//int     __fastcall _SetTextCharacterExtra( EICTag Tag, HDC hdc, int nCharExtra);
//void    __fastcall _SetTextJustification(EICTag Tag, HDC hdc, int nBreakExtra, int nBreakCount);

void    __fastcall _GetTextExtentPoint32( EICTag Tag, HDC hdc, LPCTSTR lpString, int cbString, LPSIZE lpSize);
void    __fastcall _GetTextExtentExPoint( EICTag Tag, HDC hdc, LPCTSTR lpszStr,	int cchString, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize);
int     __fastcall _GetClipRgn( EICTag Tag, HDC hdc, HRGN hrgn);
int     __fastcall _GetClipBox( EICTag Tag, HDC hdc, LPRECT lprc);
int     __fastcall _SelectClipRgn( EICTag Tag, HDC hdc,	HRGN hrgn);

HGDIOBJ __fastcall _SelectObject( EICTag Tag, HDC hdc, HGDIOBJ hgdiobj);
void    __fastcall _DeleteObject( EICTag Tag, HGDIOBJ hObject);
HGDIOBJ __fastcall _GetCurrentObject( EICTag Tag, HDC hdc, UINT uObjectType);
int     __fastcall _GetObject( EICTag Tag, HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);

HFONT   __fastcall _CreateFontIndirect( EICTag Tag, CONST LOGFONT *lplf);
HBRUSH  __fastcall _CreateSolidBrush( EICTag Tag, COLORREF crColor);
HRGN    __fastcall _CreateRectRgn( EICTag Tag,  int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
HRGN    __fastcall _CreateRectRgnIndirect( EICTag Tag, CONST RECT *lprc);
int     __fastcall _CombineRgn( EICTag Tag, HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2, int fnCombineMode);
void    __fastcall _SetRectRgn( EICTag Tag, HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
int     __fastcall _GetRgnBox( EICTag Tag, HRGN hrgn, LPRECT lprc);
bool    __fastcall _RectInRegion( EICTag Tag, HRGN hrgn, CONST RECT *lprc);
HRGN    __fastcall _CreatePolygonRgn(EICTag Tag, CONST POINT *lppt,	int cPoints, int fnPolyFillMode);
HBITMAP __fastcall _CreateBitmap( EICTag Tag, int nWidth, int nHeight, UINT cPlanes, UINT cBitsPerPel, CONST VOID *lpvBits);
HBITMAP __fastcall _CreateCompatibleBitmap( EICTag Tag, HDC hdc, int nWidth, int nHeight);

COLORREF __fastcall _GetTextColor( EICTag Tag, HDC hdc);
COLORREF __fastcall _SetTextColor( EICTag Tag, HDC hdc,	COLORREF crColor);
COLORREF __fastcall _SetBkColor( EICTag Tag, HDC hdc, COLORREF crColor);
int      __fastcall _SetBkMode( EICTag Tag, HDC hdc, int iBkMode);
COLORREF __fastcall _GetNearestColor( EICTag Tag, HDC hdc, COLORREF crColor);

void __fastcall _BeginPath( EICTag Tag, HDC hdc);
void __fastcall _EndPath( EICTag Tag, HDC hdc);
HRGN __fastcall _PathToRegion( EICTag Tag, HDC hdc);
void __fastcall _StrokePath( EICTag Tag, HDC hdc);
int  __fastcall _OffsetRgn( EICTag Tag, HRGN hrgn, int nXOffset, int nYOffset);

int     __fastcall _SetMapMode( EICTag Tag, HDC hdc, int fnMapMode);
int     __fastcall _GetMapMode( EICTag Tag, HDC hdc);

void    __fastcall _SetWindowExtEx( EICTag Tag, HDC hdc, int nXExtent, int nYExtent, LPSIZE lpSize);
void    __fastcall _SetViewportExtEx( EICTag Tag, HDC hdc, int nXExtent, int nYExtent, LPSIZE lpSize);

HLOCAL  __fastcall _LocalAlloc( EICTag Tag, UINT uFlags, UINT uBytes);
void    __fastcall _LocalFree( EICTag Tag, HLOCAL hMem);
HGLOBAL __fastcall _GlobalAlloc( EICTag Tag, UINT uFlags, UINT uBytes);
LPVOID  __fastcall _GlobalLock( EICTag Tag, HGLOBAL hMem);
void    __fastcall _GlobalUnlock( EICTag Tag, HGLOBAL hMem);
void    __fastcall _GlobalFree( EICTag Tag, HGLOBAL hMem);

int     __fastcall _StartDoc( EICTag Tag, HDC hdc, CONST DOCINFO *lpdi);
int     __fastcall _StartPage( EICTag Tag, HDC hdc);
int     __fastcall _EndPage( EICTag Tag, HDC hdc);
int     __fastcall _EndDoc( EICTag Tag, HDC hdc);
int     __fastcall _AbortDoc( EICTag Tag, HDC hdc);
void    __fastcall _OpenPrinter( EICTag Tag, LPTSTR pPrinterName,	LPHANDLE phPrinter,	LPPRINTER_DEFAULTS pDefault);
void    __fastcall _ClosePrinter( EICTag Tag, HANDLE hPrinter);
HDC     __fastcall _ResetDC( EICTag Tag, HDC hdc,	CONST DEVMODE *lpInitData);
LONG    __fastcall _DocumentProperties( EICTag Tag, HWND hWnd, HANDLE hPrinter,	LPTSTR pDeviceName,	PDEVMODE pDevModeOutput, PDEVMODE pDevModeInput, DWORD fMode);

UINT         __fastcall _GetMetaFileBitsEx( EICTag Tag, HMETAFILE hmf, UINT nSize, LPVOID lpvData);
HENHMETAFILE __fastcall _SetWinMetaFileBits( EICTag Tag, UINT cbBuffer, CONST BYTE *lpbBuffer, HDC hdcRef, CONST METAFILEPICT *lpmfp);
void         __fastcall _DeleteMetaFile( EICTag Tag, HMETAFILE hemf);
HDC          __fastcall _CreateEnhMetaFile( EICTag Tag, HDC hdcRef, LPCTSTR lpFilename, CONST RECT *lpRect, LPCTSTR lpDescription);
HENHMETAFILE __fastcall _CloseEnhMetaFile( EICTag Tag, HDC hdc);
void         __fastcall _PlayEnhMetaFile( EICTag Tag, HDC hdc, HENHMETAFILE hemf, CONST RECT *lpRect);
void         __fastcall _DeleteEnhMetaFile( EICTag Tag, HENHMETAFILE hemf);
HENHMETAFILE __fastcall _GetEnhMetaFile( EICTag Tag, LPCTSTR lpszMetaFile);
UINT         __fastcall _GetEnhMetaFileHeader( EICTag Tag, HENHMETAFILE hemf,	UINT cbBuffer, LPENHMETAHEADER lpemh);
class TCoordonnee;
HDC          __fastcall _MyCreateEnhMetaFile( EICTag Tag, const TCoordonnee &X, const TCoordonnee &Y,
                                              DWORD dwDPI, const AnsiString &s=EmptyStr);       // DPI (logical units)

#endif

